//
//  ViewController.m
//  InAppDemo
//
//  Created by yusaiyan on 2018/7/28.
//  Copyright © 2018年 QunYu. All rights reserved.
//

#import "ViewController.h"
#import "InAppPayment.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    button.backgroundColor = [UIColor redColor];
    [button addTarget:self action:@selector(clickTestBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)clickTestBtnAction {
    NSString *pid = @"";
    [[InAppPayment shareInstance] createPaymentWithPID:pid success:^(id responseObject) {
        // 支付成功 将responseObject发送服务端，由服务端向苹果服务器发起验证并处理结果
        NSLog(@"responseObject : %@", responseObject);
        
    } failed:^(NSError *error) {
        NSLog(@"error : %@", error);
    }];
}

@end
